package com.data.model.sqlclause.where.exprssion;

import com.data.model.enums.ExpressionTypeEnum;
import com.data.model.sqlclause.where.basic.Expression;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrExpression extends Expression {
    /**
     * 参数
     */
    private List<Expression> expressions;

    @Override
    public String getType() {
        return ExpressionTypeEnum.OR.getCode();
    }

    public static OrExpression of(Expression... expressions) {
        OrExpression orExpression = new OrExpression();
        orExpression.setExpressions(Arrays.asList(expressions));
        return orExpression;
    }

    public static OrExpression of(List<Expression> expressions) {
        OrExpression orExpression = new OrExpression();
        orExpression.setExpressions(expressions);
        return orExpression;
    }
}
